<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>合二为一</title>
    <style>
        /* 大于768 */
        /* 最大宽度768px,小于等于768px */
        /* 最小宽度768px,大于等于768px */
        * {
                margin: 0;
                padding: 0;
            }

        li {
            list-style: none;
        }

        .container{
            height: 30px;
        }

        .container ul li {
            float: left;
            height: 30px;
            background-color: green;
            color: white;
        }
        
        @media screen and (min-width: 768px) {
            
            .container {
                margin: 0 auto;
                width: 750px;
            }

            .container ul li {
                width: 93.75px;
            }
        }

        /* 小于768 */
        @media screen and (max-width: 768px) {

            .container {
                width: 100%;
            }

            .container ul li {
                width: 33.33%;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <ul>
            <li>导航</li>
            <li>导航</li>
            <li>导航</li>
            <li>导航</li>
            <li>导航</li>
            <li>导航</li>
            <li>导航</li>
            <li>导航</li>
        </ul>
    </div>
</body>

</html>